home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_exmh.idb / usr / freeware / lib / exmh-2.5 / pgpShared.tcl.z / pgpShared.tcl
Text File  |  2002-07-08  |  8KB  |  199 lines

  1. # pgpShared.tcl
  2.  
  3. # $Log: pgpShared.tcl,v $
  4. # Revision 1.5  1999/09/27 23:18:46  kchrist
  5. # More PGP changes. Consolidated passphrase entry to sedit field or
  6. # pgpExec routine. Made the pgp-sedit field aware of pgp(keeppass)
  7. # and pgp(echopass). Moved pgp(keeppass), pgp(echopass) and
  8. # pgp(grabfocus) to PGP General Interface. Fixed a minor bug left
  9. # over from my previous GUI changes. Made pgp-sedit field appear and
  10. # disappear based on its enable preference setting.
  11. #
  12. # Revision 1.4  1999/08/13 00:39:06  bmah
  13. # Fix a number of key/passphrase management problems:  pgpsedit now
  14. # manages PGP versions, keys, and passphrases on a per-window
  15. # basis.  Decryption now works when no passphrases are cached.
  16. # One timeout parameter controls passphrases for all PGP
  17. # versions.  seditpgp UI slightly modified.
  18. #
  19. # Revision 1.3  1999/08/03 18:32:02  bmah
  20. # Cosmetic fixes:  PGP 2 is now specified explicitly in all prompts
  21. # (instead of old "PGP").  The term "passphrase" is now used
  22. # consistently.
  23. #
  24. # Revision 1.2  1999/08/03 04:05:56  bmah
  25. # Merge support for PGP2/PGP5/GPG from multipgp branch.
  26. #
  27. # Revision 1.1.4.1  1999/06/14 20:05:17  gruber
  28. # updated multipgp interface
  29. #
  30. # Revision 1.1  1999/06/14 15:14:55  markus
  31. # added files
  32. #
  33. # Revision 1.2  1998/12/06 16:19:32  markus
  34. # Updated for DecryptExpect
  35. # Put pref(useexpectk) here
  36. #
  37. # Revision 1.1.1.1  1998/11/24 22:34:46  markus
  38. # Initial revision
  39. #
  40.  
  41. proc Pgp_Shared_Init {} {
  42. global pgp
  43. ###
  44.  
  45. ############
  46. # Menutexts
  47. set pgp(menutext,signclear) "Check the signature"
  48. set pgp(menutext,signbinary) "Verify and show content"
  49. set pgp(menutext,encrypt) "Decrypt"
  50. set pgp(menutext,encryptsign) "Decrypt and verify"
  51. set pgp(menutext,keys-only) "Extract keys"
  52.  
  53. #########
  54. # Decode
  55. set pgp(decode,none) 0
  56. set pgp(decode,all) 1
  57. set pgp(decode,keys) {$action == "keys-only"}
  58. set pgp(decode,signed) {![regexp {encrypt} $action]}
  59.  
  60. #########################
  61. # Set pgp message colors
  62. if {[winfo depth .] > 4} {
  63.     Preferences_Resource pgp(msgcolor,Bad) m_pgpBad \
  64.              "-foreground red"
  65.     Preferences_Resource pgp(msgcolor,GoodUntrustedSig) \
  66.              m_pgpGoodUntrustedSig "-foreground blue"
  67.     Preferences_Resource pgp(msgcolor,GoodTrustedSig) \
  68.              m_pgpGoodTrustedSig "-foreground darkgreen"
  69.     Preferences_Resource pgp(msgcolor,OtherMsg) \
  70.              m_pgpOtherMsg {}
  71. } else {
  72.     Preferences_Resource pgp(msgcolor,Bad) m_pgpBad {}
  73.     Preferences_Resource pgp(msgcolor,GoodUntrustedSig) \
  74.              m_pgpGoodUntrustedSig {}
  75.     Preferences_Resource pgp(msgcolor,GoodTrustedSig) \
  76.              m_pgpGoodTrustedSig {}
  77.     Preferences_Resource pgp(msgcolor,OtherMsg) m_pgpOtherMsg {}
  78. }
  79.  
  80. #######################
  81. # Standard Preferences
  82. #
  83. set pgp(pref,rfc822) { rfc822 Rfc822 OFF {Encrypt headers}
  84. "Used to encrypt the whole message, instead of only encrypting
  85. the body, so that the subject line (for instance) is also
  86. safely transmitted." }
  87. #
  88. set pgp(pref,choosekey) { choosekey ChooseKey ON {Always choose the sign-key}
  89. "When signing a message, sedit can either use the default key or ask
  90. the user to choose which key he wants to use. Of course, if you only
  91. have 1 private key this setting doesn't interest you much." }
  92. #
  93. set pgp(pref,useexpectk) { useexpectk UseExpectk OFF {Use expectk if available}
  94. "Expectk is a utility that can communicate interactively with both
  95. PGP and exmh.  With this option enabled, messages will take longer
  96. to decrypt, but exmh will use the correct pass phrase.  Do not turn
  97. this on unless you have \"Separate background process\" in
  98. Preferences->Background Processing on.  This is recommended if you
  99. have more than one secret key." }
  100. #
  101. set pgp(pref,runtwice) { runtwice RunTwice OFF {Run <label> twice for decryption}
  102. "With this option enabled, exmh will run <label> twice to first
  103. get out the keyid of the decryption key and then use the
  104. right passphrase for decryption.
  105. This is recommended if you have more than one secret key.
  106. This is similar to the option \"Use expectk if available\", but faster." }
  107. #
  108. set pgp(pref,cacheids) { cacheids CacheIds {CHOICE persistent temporary none}
  109. {Cache map from email to public-key}
  110. "The way exmh figures out the public-key to use for an email address is
  111. often slow. This option allows you to cache the result of the matching
  112. so that it doesn't have to be done over and over. Furthermore the cache
  113. can be saved in a file .matchcache.<label> in your pgp directory so as
  114. to make it persistent accross exmh sessions." }
  115. #
  116. set pgp(pref,minmatch) { minmatch MinMatch 75 {Minimum match correlation (in percents)}
  117. "When trying to find the key corresponding to an email address,
  118. exmh tries to be 'smart' and does an approximate matching. If the 
  119. match's quality is better than the specified percentage, exmh will
  120. assume it's the right key. Else it will query the user. Hence, a
  121. value greater than 100 will make exmh always query the user." }
  122. #
  123. set pgp(pref,showinline) { showinline ShowInline {CHOICE none keys signed all}
  124. {Show pgp messages inline}
  125. "controls which pgp parts get automatically decoded with <label>. Since
  126. decoding generally takes time, and since clear signed messages can
  127. be viewed without <label>, it makes sense to limit the decoding to rare
  128. cases like key parts:
  129.  - keys: only auto-decode key parts
  130.  - signed: auto-decode key and signed parts" }
  131. #
  132. set pgp(pref,shortmsgs) { shortmsgs ShortMessages OFF "Short <label> reports"
  133. {If this is selected Exmh tries to report PGP results in one line, 
  134. otherwise more of the text from PGP itself is used.  For example:
  135.  
  136. Good signature from user "John Smith <jsmith@well.com>".
  137. Signature made 1996/12/30 16:34 GMT
  138.  
  139. WARNING:  Because this public key is not certified with a trusted
  140. signature, it is not known with high confidence that this public key
  141. actually belongs to: "John Smith <jsmith@well.com>".
  142.  
  143. versus
  144.  
  145. Good untrusted signature from "John Smith <jsmith@well.com>" } }
  146. #
  147. set pgp(pref,autoextract) { autoextract AutoExtract ON {Extract keys automatically}
  148. "When you receive a keys-only part, you can have its content
  149. displayed and you can extract its content into your public
  150. key ring. The extraction can be safely done automatically,
  151. but you might prefer doing it manually, with a menu entry
  152. on the keys-only part." }
  153.  
  154. ########################
  155. # Public Key Algorithms
  156. set pgp(pubkeyalgo,1)  rsa
  157. set pgp(pubkeyalgo,16) elgamal/s
  158. set pgp(pubkeyalgo,17) dsa
  159. set pgp(pubkeyalgo,20) elgamal/s+e
  160.  
  161. ##############
  162. # Preferences
  163. proc Pgp_Preferences { v } {
  164.     global pgp
  165.  
  166.     # The first insertion should contain the description of the package
  167.     set prefs [set pgp($v,prefs)]
  168.     set first [lindex $prefs 0]
  169.     set label [set pgp($v,fullName)]
  170.     Preferences_Add "$label interface" [set pgp($v,description)] \
  171.        [list \
  172.         [list pgp($v,[lindex [set pgp(pref,$first)] 0]) \
  173.          ${v}[lindex [set pgp(pref,$first)] 1] \
  174.          [lindex [set pgp(pref,$first)] 2] \
  175.          [regsub -all <label> [lindex [set pgp(pref,$first)] 3] $label t; set t] \
  176.          [regsub -all <label> [lindex [set pgp(pref,$first)] 4] $label t; set t] \
  177.         ] \
  178.        ]
  179.     set prefs [lrange $prefs 1 end]
  180.     # Now insert rest
  181.     foreach pref $prefs {
  182.       Preferences_Add "$label interface" {} \
  183.        [list \
  184.         [list pgp($v,[lindex [set pgp(pref,$pref)] 0]) \
  185.         ${v}[lindex [set pgp(pref,$pref)] 1] \
  186.         [lindex [set pgp(pref,$pref)] 2] \
  187.         [regsub -all <label> [lindex [set pgp(pref,$pref)] 3] $label t; set t] \
  188.         [regsub -all <label> [lindex [set pgp(pref,$pref)] 4] $label t; set t] \
  189.        ] \
  190.       ]
  191.     }
  192.  
  193.     # Call the modules Preferences proc, which adds module specific Prefs
  194.     Pgp_${v}_Preferences
  195. }
  196.  
  197. ###
  198. }
  199.